Skip to content

Remove the default collected output buffer limit and throw an error when the limit is reached #130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 30, 2025

Conversation

iCharlesHu
Copy link
Contributor

As discussed in #44 , remove the default output limit since we can't really specify one. Also throw an error if output exits limit.

Resolves: #44

@@ -70,18 +71,20 @@ extension SubprocessError {
return 6
case .asyncIOFailed(_):
return 7
case .failedToSendSignal(_):
case .outputBufferLimitExceeded(_):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After we set the API we should probably consider the error numbers to be frozen, in case people have written documentation about them or compare them to raw values.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. I'm only doing this because we haven't tagged 0.0.1 yet.

if maxLength != .max {
// If we actually have a max length, attempt to read one
// more byte to determine whether output exceeds the limit
maxLength += 1
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean that we've drained 1 more byte from the I/O than the caller expected?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Unfortunately this is the only way to detect whether there's more data coming. If the caller was only expected N bytes, then the child process should only process N bytes with EOF at the end. If not then we considered this an error.

@iCharlesHu iCharlesHu force-pushed the charles/buffer-limit-error branch from 2577a37 to ba88b42 Compare July 29, 2025 17:51
@iCharlesHu iCharlesHu merged commit f3f9512 into swiftlang:main Jul 30, 2025
21 checks passed
@iCharlesHu iCharlesHu deleted the charles/buffer-limit-error branch July 30, 2025 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

run appears to be stuck (due to buffer limit?)
3 participants